﻿#region Includes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace GingerGL.Graphics
{
    //------------------------------------------------------------//
    /// <summary>
    /// Display List Collection
    /// </summary>
    public class DisplayListManager
    {
        //--------------------------------------------------------//
        #region Variables
        private List<DisplayList> mDisplayLists = new List<DisplayList>();
        #endregion
        //--------------------------------------------------------//
        #region Methods
        /// <summary>
        /// Invalidate all lists in the collection
        /// </summary>
        public void Invalidate()
        {
            foreach (DisplayList d in mDisplayLists)            //reset lists
                d.Invalidate();
        }
        /// <summary>
        /// Invalidates and Clears the Collection
        /// </summary>
        public void Flush()
        {
            Invalidate();                                       //reset lists
            mDisplayLists.Clear();                              //reset collection
        }
        /// <summary>
        /// Creates a new Display and Associates the list with collection
        /// </summary>
        /// <returns>New Display List</returns>
        public DisplayList CreateDisplayList()
        {
            DisplayList d = new DisplayList();                  //create list
            mDisplayLists.Add(d);                               //add to collection
            return d;                                           //return it
        }
        /// <summary>
        /// Delete List from Collection
        /// </summary>
        /// <param name="d">List to be deleted</param>
        public void DeleteList(DisplayList d) 
        { 
            mDisplayLists.Remove(d);                            //bye bye
        }
        #endregion
        //--------------------------------------------------------//
    }
    //------------------------------------------------------------//
}
